<!DOCTYPE html>
<html lang="cn">
<head>
<#include "/admin/common/app.ftl">
</head>
<body class="container-fluid">
	<div class="page-title">
		<div class="title-env">
			<h1 class="title">文章管理</h1>
			<p class="description">Plain text boxes, select dropdowns and other basic form elements</p>
		</div>
		<div class="breadcrumb-env">
			<a class="btn btn-primary btn-sm" href="${basePath}/cms/content/edit"><span class="fa fa-plus"></span> 内容</a>
			<a class="btn btn-primary btn-sm" href="${basePath}/cms/content/edit?type=movie"><span class="fa fa-plus"></span> 电影</a>
		</div>
	</div>
	<div class="row">
		<div class="col-xs-12">
			<table class="table tree">
				<thead>
					<tr class="treegrid-1">
						<th>名称</th>
						<th>类型</th>
						<th>日期</th>
						<th>操作</th>
					</tr>
				</thead>
				<#list page.data as item>
				<tr>
					<td><a target="_blank" href="${basePath}/a/${item.id}">${item.title}</a></td>
					<td>${item.type}</td>
					<td>${item.createDate}</td>
					<td><a href="${basePath}/cms/content/edit?id=${item.id}"><span class="fa fa-edit"></span></a> / <a href="javascript:void(0);"
						onclick="del(${item.id})"><span class="fa fa-trash"></span></a></td>
				</tr>
				</#list>
			</table>
			<nav>
				<ul class="pagination">
					<#if param.page &gt; 1>
					<#assign temppage = param.page - 1>
					<li><a href="${basePath}/cms/content?page=${temppage}" aria-label="Previous"> <span aria-hidden="true">&laquo;</span></a></li>
					</#if>
					<#list -3..3 as c>
					<#assign temppage = param.page + c>
					<#if temppage&gt;=1 && param.maxPage &gt;= temppage>
					<li <#if param.page==temppage>class="active"</#if>>
						<a <#if param.page !=temppage> href="${basePath}/cms/content?page=${temppage}"</#if>>${temppage}</a></li> 
					</#if>
					</#list>
					<#if param.page &lt; page.maxPage>
					<#assign temppage = param.page + 1>
					<li><a href="${basePath}/cms/content?page=${temppage}" aria-label="Next"> <span aria-hidden="true">&raquo;</span></a></li>
					</#if>
				</ul>
			</nav>
		</div>
	</div>
	<script type="text/javascript">
		function del(id) {
			if (confirm("确认删除?")) {
				jQuery.ajax({
					url : "${basePath}/cms/content/del?id=" + id,
					dataType : "json",
					success : function(json) {
						if (json.flag) {
							window.location.reload();
						} else {
							alert(json.msg);
						}
					}
				});
			}
		}
	</script>
</body>
</html>